#include <cstdio>
#include <map>
using namespace std;
const int maxn = 500000;
map<int, int> mp;
int main()
{
    int M, N;
    scanf("%d%d", &M, &N);
    int total = M * N;
    int i;
    int color[maxn] = {0};
    for (i = 0; i < total; ++i)
    {
        scanf("%d", color + i);
        mp[color[i]] = 0;
    }
    int cnt = total / 2;
    for (i = 0; i < total; ++i)
    {
        mp[color[i]] = mp[color[i]] + 1;
        if (mp[color[i]] > cnt)
        {
            printf("%d\n", color[i]);
            break;
        }
    }
    return 0;
}